<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Insert title here</title>
<link href="/resource/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="/resource/js/bootstrap.js"></script>
<script type="text/javascript">

$(function(){
	var names =JSON.parse('${names}');

	for(var i in names){
      $("[name='colors'][value='"+names[i]+"']").prop("checked",true)	  
 	}
	
})

</script>
</head>
<body>

	<form>
		车牌号：<input type="text" name="cno" value="${car.cno }">
		颜色： <input type="checkbox" name="colors" value="黑">黑 <input
			type="checkbox" name="colors" value="白">白 <input
			type="checkbox" name="colors" value="红">红 <input
			type="checkbox" name="colors" value="蓝">蓝
			 车辆类型：<select
			name="carType">
				<option value="">请选择</option>
			<c:forEach items="${types }" var="type">
			
				<option value="${type}">${type.name }</option>

			</c:forEach>


		</select>
		<button type="submit">查询</button>
		 <a href="/add">新建入库</a>
		 <a href="/getReport">报表汇总</a>

	</form>



	<table class="table">
		<tr>
			<td>id</td>
			<td>车牌号码</td>

			<td>入库时间</td>

			<td>颜色</td>
			<td>长度</td>
			<td>类型</td>
			<td>操作</td>
		</tr>

		<c:forEach items="${info.list}" var="car">
			<tr>
				<td>${car.id }</td>
				<td>${car.cno }</td>
				<td><fmt:formatDate value="${car.inTime }"
						pattern="yyyy-MM-dd HH:mm" /></td>
				<td>${car.color }</td>
				<td>${car.length }</td>
				<td>${car.carType.name }</td>
				<td><a href="/outStore?id=${car.id}">出库</a></td>
			</tr>
		</c:forEach>

	</table>

	<div>

		<jsp:include page="/WEB-INF/view/pages.jsp"></jsp:include>

	</div>
</body>
<script type="text/javascript">
function goPage(pageNum){
	location.href="/list?pageNum="+pageNum
}

</script>
</html>